import util from "@/libs/util";

export default ({ request }) => ({
  /**
   * @description 店铺街
   * @param {Object} data
   */
  SHOP_STREET(data = {}) {
    let userinfo = util.store.getItem("userinfo");
    data.id = userinfo ? userinfo.user_id : null;

    return request({
      url: "/data/v1/shopStreet",
      method: "post",
      data: data,
    });
  },
  /**
   * @description 店铺首页
   * @param {Object} data
   */
  SHOP_INDEX(data = {}) {
    let userinfo = util.store.getItem("userinfo");
    data.id = userinfo ? userinfo.user_id : null;

    return request({
      url: "/data/v1/shopIndex",
      method: "post",
      data: data,
    });
  },
  /**
   * @description 店铺列表
   * @param {Object} data
   */
  SHOP_LIST(data = {}) {
    let userinfo = util.store.getItem("userinfo");
    data.id = userinfo ? userinfo.user_id : null;

    return request({
      url: "/data/v1/shopList",
      method: "post",
      data: data,
    });
  },
  /**
   * @description 关注店铺列表
   * @param {Object} data
   */
  SHOPS_COLLECTION_LIST(data = {}) {
    let userinfo = util.store.getItem("userinfo");
    data.id = userinfo ? userinfo.user_id : null;

    return request({
      url: "/data/v1/shopCollectionList",
      method: "post",
      data: data,
    });
  },
  /**
   * @description 店铺关注+取消
   * @param {Object} data
   */
  SHOPS_COLLECTION(data = {}) {
    let userinfo = util.store.getItem("userinfo");
    data.user_id = userinfo ? userinfo.user_id : null;

    return request({
      url: "/data/v1/shopCollection",
      method: "post",
      data: data,
    });
  },
});
